import request from '@/utils/request';

// 获取兑换码列表
export function getExchangeCodeList(params) {
  return request({
    url: '/backend/exchange/getExchangeCodeList',
    method: 'get',
    params
  });
}

// 获取兑换码详情
export function getExchangeCodeDetail(id) {
  return request({
    url: `/backend/exchange/getExchangeCodeDetail`,
    method: 'get',
    params: {
      id
    }
  });
}

// 新增兑换码
export function createExchangeCode(data) {
  return request({
    url: '/backend/exchange/addExchangeCode',
    method: 'post',
    data
  });
}

// 更新兑换码
export function updateExchangeCode(id, data) {
  return request({
    url: `/backend/exchange/updateExchangeCode`,
    method: 'put',
    data: {
      id,
      ...data
    }
  });
}

// 删除兑换码
export function deleteExchangeCode(id) {
  return request({
    url: `/backend/exchange/deleteExchangeCode`,
    method: 'delete',
    data: {
      id
    }
  });
}

// 获取兑换码使用记录
export function getExchangeCodeUsageList(params) {
  return request({
    url: '/backend/exchange/getUsageList',
    method: 'get',
    params
  });
}

// 批量生成兑换码
export function batchGenerateExchangeCodes(data) {
  return request({
    url: '/backend/exchange/batchGenerate',
    method: 'post',
    data
  });
} 